home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: jyacc!marks!jtrigg@uunet.uu.net (Jim Trigg)
- Newsgroups: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
- Subject: Re: C coding problem
- Date: 16 Mar 1996 09:44:02 -0600
- Organization: JYACC, Inc.
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4ienk2$a5t@solutions.solon.com>
- References: <4ianbf$h86@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Nntp-Posting-Host: marks
- X-Newsreader: Gnus v5.1
-
- In article <4ianbf$h86@solutions.solon.com> proctor@corp.hp.com
- (Stephen Proctor) writes:
-
- > I am trying to write a *simple* C program and am running into the following
- > warning problem shown below. Why do I get this warning?
-
- > It seems to have an effect on the logic of the program when executed.
-
- > I am try to examine the first character in a command line argument, argv[],
- > to the program for the presence of a "-" sign to identify the argument as
- > an option.
-
- > % c89 shell.c -o shell
- > cc: "shell.c", line 98: warning 608: Illegal integer-pointer
- > combination in assignment.
-
- > 2.) The program is as follows,
-
- > #include <stdio.h>
- > #include <ctype.h>
- > #include <string.h>
- > #include <stdlib.h>
-
- > main(int argc, char *argv[])
- > {
- > int ii;
- > int option_val = 0;
- > /* skip lines */
- > for (ii=1; ii<argc; ii++) {
- > /* skip lines */
- > /* The next line is the offending line */
- > if (*argv[ii] == '-') option_val = read_options;
- ^^^^^^^^^^^^
- > /* skip lines */
- > return 0; /* Program executed successfully */
- > }
-
- What is read_options? If it is a function, the assignment should be:
- option_val = read_options();
- Otherwise you are trying to assign the address of the function to
- option_val and that is your problem.
-
- Just a Thought,
- Jim Trigg
-